<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>饼图</title>
  <script src="../lib/echarts.min.js"></script>
</head>

<body>
  <!-- 直接样式：itemStyle textStyle lineStyle areaStyle label -->
  <div id="echarts" style="width: 600px;height:400px;"></div>
  <script>

    let mCharts = echarts.init(document.getElementById('echarts'))
    var pieData = [
      {
        name: '淘宝',
        value: 11231,
        // 控制淘宝这一区域的样式
        itemStyle: {
          color: 'teal',
        }
      },
      {
        name: '京东',
        value: 22673
      },
      {
        name: '唯品会',
        value: 6123
      },
      {
        name: '1号店',
        value: 8989
      },
      {
        name: '聚美优品',
        value: 6700
      }
    ]
    const option = {
      title: {
        text: '饼图测试',
        textStyle: {
          color: 'blue'
        }
      },
      series: [
        {
          type: 'pie',
          naem: '饼图',
          data: pieData,
          //饼图文字的显示
          label: {
            show: true,//是否显示文字
            color: 'green'
          },
          // 高亮样式
          emphasis: {
            label:{
              color:'teal',
              fontSize:'32'
            },
            itemStyle: {
              color: '#ccc',
            }
          },
          selectedMode: 'single', //选中效果 偏离圆点一小段距离
          // selectedMode: 'multiple', //选中效果 不会自动偏移回去
          selectedOffset: 30 //偏移量

        }
      ]
    }
    mCharts.setOption(option)
  </script>
</body>

</html>